const joi = require('joi')

const id = joi.string().required()
const password = joi.string().pattern(/^[\S]{6,20}$/).required()
const status = joi.string().min(2).max(3).required()
const name = joi.string().required()
const sex = joi.string().length(1)
const school = joi.string()
const major = joi.string()
const classid = joi.string()
const department = joi.string()

exports.reg_register_schema = {
  body: {
    id,
    name,
    sex,
    school,
    major,
    classid,
    department,
    status
  }
}
exports.reg_login_schema = {
  body: {
    id,
    password,
    status
  }
}
exports.reg_updateInfo_schema = {
  body: {
    id,
    school,
    major,
    department,
    classid,
    status
  }
}
exports.update_password_schema = {
  body: {
    oldPwd: password,
    newPwd: joi.not(joi.ref('oldPwd')).concat(password)
  }
}